#include<iostream>
#include<cstdio>
using namespace std;
int a, b, c, d;
int main()
{
	int t;
	cin >> t;
	while (t--) {
		cin >> a >> b >> c >> d;
		bool flag = 0;
		if (b > a && d > b && d > c && c > a) {
			flag = 1;
		}
		else {
			for (int i = 0; i < 3; i++) {
				int t1, t2, t3, t4;
				if (i == 0) {
					t1 = c;
					t2 = a;
					t3 = d;
					t4 = b;
				}
				else if (i == 1) {
					t1 = d;
					t2 = b;
					t3 = c;
					t4 = a;
				}
				else {
					t1 = b;
					t2 = d;
					t3 = a;
					t4 = c;
				}
				if (t2 > t1 && t3 > t1 && t4 > t2 && t4 > t3) {
					flag = 1;
				}
			}
		}
		if (flag) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
	return 0;
}